package top.z.work.module.system.service.impl;

import cn.dev33.satoken.secure.SaSecureUtil;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.z.work.module.system.entity.SystemUser;
import top.z.work.module.system.mapper.SystemUserMapper;
import top.z.work.module.system.service.SystemUserService;

/**
 * 系统用户ServiceImpl
 *
 * @author zaoangod
 * @since 2024-03-22
 */
@Service
public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUser> implements SystemUserService {

    /**
     * 加密密码
     *
     * @param loginName 登录账号
     * @param password  明文密码
     * @param salt      盐
     * @return 加密后的密码
     */
    @Override
    public String encryptPassword(String loginName, String password, String salt) {
        return SaSecureUtil.md5BySalt(loginName + password, salt);
    }

}
